/* 全局样式 */
.stApp {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 主容器样式 */
.main .block-container {
    padding-top: 2rem;
    padding-bottom: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin: 1rem;
}

/* 侧边栏样式 */
.css-1d391kg {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-radius: 0 15px 15px 0;
}

/* 标题样式 */
.stApp h1 {
    color: #2c3e50;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.stApp h2 {
    color: #34495e;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.stApp h3 {
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* 按钮样式 */
.stButton > button {
    border-radius: 25px;
    border: none;
    background: linear-gradient(45deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.stButton > button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(45deg, #2980b9 0%, #3498db 100%);
}

.stButton > button:active {
    transform: translateY(0);
}

/* 主要按钮样式 */
.stButton > button[kind="primary"] {
    background: linear-gradient(45deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.stButton > button[kind="primary"]:hover {
    background: linear-gradient(45deg, #c0392b 0%, #e74c3c 100%);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* 次要按钮样式 */
.stButton > button[kind="secondary"] {
    background: linear-gradient(45deg, #95a5a6 0%, #7f8c8d 100%);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

/* 输入框样式 */
.stTextInput > div > div > input,
.stSelectbox > div > div > select,
.stTextArea > div > div > textarea {
    border-radius: 10px;
    border: 2px solid #bdc3c7;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.stTextInput > div > div > input:focus,
.stSelectbox > div > div > select:focus,
.stTextArea > div > div > textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

/* 指标卡片样式 */
.metric-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin: 0.5rem 0;
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.metric-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 数据表格样式 */
.stDataFrame {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 选项卡样式 */
.stTabs [data-baseweb="tab-list"] {
    gap: 8px;
    background: transparent;
}

.stTabs [data-baseweb="tab"] {
    height: 50px;
    background: linear-gradient(45deg, #ecf0f1 0%, #bdc3c7 100%);
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    border: none;
    padding: 0 1.5rem;
}

.stTabs [aria-selected="true"] {
    background: linear-gradient(45deg, #3498db 0%, #2980b9 100%);
    color: white !important;
}

/* 进度条样式 */
.stProgress .css-0 {
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    border-radius: 10px;
}

/* 警告框样式 */
.stAlert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
}

.stAlert[data-baseweb="alert"] {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 5px solid #f39c12;
}

/* 成功消息样式 */
.stSuccess {
    background: linear-gradient(135deg, #d1edff 0%, #a8e6cf 100%);
    border-left: 5px solid #27ae60;
    border-radius: 10px;
    padding: 1rem 1.5rem;
}

/* 错误消息样式 */
.stError {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 5px solid #e74c3c;
    border-radius: 10px;
    padding: 1rem 1.5rem;
}

/* 信息消息样式 */
.stInfo {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 5px solid #3498db;
    border-radius: 10px;
    padding: 1rem 1.5rem;
}

/* 文件上传器样式 */
.stFileUploader {
    border: 2px dashed #bdc3c7;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s ease;
}

.stFileUploader:hover {
    border-color: #3498db;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

/* 滑块样式 */
.stSlider {
    padding: 1rem 0;
}

.stSlider .css-0 {
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    border-radius: 10px;
}

/* 多选框样式 */
.stCheckbox {
    margin: 0.5rem 0;
}

.stCheckbox label {
    font-weight: 500;
    color: #2c3e50;
}

/* 单选框样式 */
.stRadio {
    margin: 1rem 0;
}

.stRadio label {
    font-weight: 500;
    color: #2c3e50;
}

/* 分割线样式 */
.stMarkdown hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #3498db 50%, transparent 100%);
    margin: 2rem 0;
}

/* 代码块样式 */
.stCode {
    background: #2c3e50;
    color: #ecf0f1;
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Monaco', 'Consolas', monospace;
    border: 1px solid #34495e;
}

/* 图表容器样式 */
.js-plotly-plot {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main .block-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .stButton > button {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    .metric-container {
        padding: 1rem;
    }
}

/* 自定义动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* 深色主题样式 */
@media (prefers-color-scheme: dark) {
    .stApp {
        background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    }
    
    .main .block-container {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .stApp h1, .stApp h2, .stApp h3 {
        color: #ecf0f1;
    }
    
    .stTextInput > div > div > input,
    .stSelectbox > div > div > select,
    .stTextArea > div > div > textarea {
        background: #34495e;
        color: #ecf0f1;
        border-color: #7f8c8d;
    }
}

/* 自定义徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
}

.badge-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.badge-warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.badge-danger {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.badge-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
}

/* 卡片样式 */
.card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin: 1rem 0;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* 加载动画 */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 状态指示器 */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-online {
    background-color: #27ae60;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.5);
}

.status-offline {
    background-color: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
}

.status-warning {
    background-color: #f39c12;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}